#include <stdio.h>
#include <stdlib.h>
#include "calculator.h"

int main()
{
    double a, b;
    char op;

    printf("请输入操作（格式：a + b）：");
    scanf("%lf %c %lf", &a, &op, &b);

    switch (op)
    {
#ifdef USE_PLUS
    case '+':
        printf("结果: %lf\n", add(a, b));
        break;
#endif
#ifdef USE_MINUS
    case '-':
        printf("结果: %lf\n", subtract(a, b));
        break;
#endif
#ifdef USE_MUL
    case '*':
        printf("结果: %lf\n", multiply(a, b));
        break;
#endif
#ifdef USE_DIV
    case '/':
        if (b != 0)
        {
            printf("结果: %lf\n", divide(a, b));
        }
        else
        {
            printf("错误: 除数不能为零\n");
        }
        break;
#endif
    default:
        printf("错误: 不支持的操作\n");
        break;
    }

    return 0;
}
